<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./public/admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="./public/admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="./public/admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./public/admin/Flat/img/favicon.ico">
	    <script src="./public/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
	    <script src="./public/uploadify/jquery.uploadify.min.js" type="text/javascript" charset="utf-8"></script>
	    <link rel="stylesheet" type="text/css" href="./public/uploadify/uploadify.css"/>
	</head>
	<body>
		<script type="text/javascript">
        $(function() {
            $('#file').uploadify({
                'formData'     : {//POST数据
                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
                },
                'fileTypeDesc' : '上传文件',//上传描述
                'fileTypeExts' : '*.jpg;*.png',
                'swf'      : '<?php echo __PUBLIC__?>/uploadify/uploadify.swf',
                'uploader' : '<?php echo U('upload')?>',
                'buttonText':'选择文件',
                'fileSizeLimit' : '2000KB',
                'uploadLimit' : 10,//上传文件数
                'width':65,
                'height':25,
                'successTimeout':10,//等待服务器响应时间
                'removeTimeout' : 0.5,//成功显示时间
                'onUploadSuccess' : function(file, data, response) {
					//转为json
                    data=$.parseJSON(data);
                    //获得图片地址
                    var imageUrl = data.url;
                    var li="<li class='imgbox' path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' style='width:200px;' /><input type='hidden' name='logo' value='"+data.path+"'/><a href='javascript:;' class='close_img' >X</a></li>";
                    $("#uploadList ul").prepend(li);
                }
            });
        });
    </script>
    <script type="text/javascript">
    
    	$(function(){
    		$('.close_img').live('click',function(){
    			$(this).parents('.imgbox').remove();
    		})
    		
    	})
		</script>
		<form action="" method="post" enctype="multipart/form-data">
		<div class="alert alert-success">添加品牌</div>
		<div class="form-group">
			<label for="exampleInputEmail1">品牌名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" name="bname" value="<?php echo $oldData['bname']?>">
		</div>
		
		<div class="form-group" id="img_box">
			<label for="exampleInputEmail1">缩略图</label>
			<!--插入图片开始-->
		<div lab="uploadFile">		
			<input id="file" type="file" multiple="true" name="logo">
			<span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
		</div>  		
					
		    <div id="uploadList">
		        <ul>	
					<li class="imgbox">
						<img src="<?php echo $oldData['logo']?>" style='height:100px;' />
						<input type='hidden' name='pic' value="<?php echo $oldData['logo']?>"/>
						<a href="javascript:;" class="close_img" >X</a>
					</li>							        	
		        </ul>
		    </div>
			
			<!--插入图片结束-->
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">排序</label>
			<input id="exampleInputEmail1" class="form-control" type="text" name="bsort" value="<?php echo $oldData['bsort']?>">
		</div>
		
		<div class="form-group">
			
			<input type="checkbox" name="ishot" id="" <?php if($oldData['ishot']==1){?>
                 checked 
               <?php }?> value="1" />

			<label for="exampleInputEmail1">是否热门</label>
		</div>
		
		<input type="hidden" name="bid" id="bid" value="<?php echo $oldData['bid']?>" />
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>
</html>
